<!DOCTYPE html>
<head>
    <#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
    <#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
    <#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
    <meta charset="utf-8">
    <title>质量管理体系基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">




    <link rel="stylesheet" href="${ctx}/qbdmsStatic/public/ztree/zTreeStyle.css"/>
    <script src="${ctx}/qbdmsStatic/public/ztree/jquery.min.js"></script>
    <script src="${ctx}/qbdmsStatic/public/ztree/jquery.ztree.all.min.js"></script>
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body class="listBody">
<div class="qbdms-bodyDiv">
    <div class="layui-table-view-body qbdms-add-view-body">
        <form class="formPreview layui-form" requrl="${ctx}/qbdms/wQbdQualitymanage/get" lay-filter="wQbdQualitymanageDataForm" id="wQbdQualitymanageDataForm">
            <div class="qbdms-formTitle">审核不符合项信息 <i class="qbdms-returnOn closeWindow" id="back">返回</i></div>
            <#if qnzl=false>
            <div class="qbdms-formBody">
                <@fillDept.dept id="tbxx"/>
                <div class="layui-row">
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核项目名称">审核项目名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input " lay-verify="required" name="audititemsname" lay-reqtext="审核项目名称是必填项" maxlength="50">
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核单位名称">审核单位名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input " lay-verify="required" name="fNameofauditinguni" lay-reqtext="审核单位名称是必填项" maxlength="50">
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="密级">密级<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@secSelect.sec_select data_src=1 required=true name="secret"/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="受审单位名称">受审单位名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="自动计算" autocomplete="off" class="layui-input textInput isReadonlyInput" lay-verify="required" lay-reqtext="受审单位名称是必填项" name="fTrialunitname" maxlength="50" readonly>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="受审核部门">受审核部门<span style="color: red;">*</span></label>
                        <button type="button" typeid="6" class="layui-btn qbdms-twoBtn selectorBtn">选择</button>
                        <div class="layui-input-block qbdms-input qbdms-inputIsButton">
                            <input type="text" name="fTrialdeptname" readonly="readonly" placeholder="请选择"
                                   autocomplete="off" class="layui-input  selectorInput"
                                   maxlength="30" fieldname="fTrialdeptname"  lay-verify="required" lay-reqtext="受审核部门是必填项">
                            <input type="hidden" name="fTrialdeptnameid" placeholder="请输入受审核部门ID"
                                   autocomplete="off" class="layui-input  textInput getIds"
                                   fieldname="fTrialdeptnameid">
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核时间">审核时间<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请选择" autocomplete="off" class="layui-input dateTimeFiled input-right time-init" name="fAudittime" format="yyyy-MM-dd" datetype="date" lay-verify="required" lay-reqtext="审核时间是必填项" readonly>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核类型">审核类型<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fAudittype" nodeKey="shlx" verify="required" reqtext="审核类型是必填项"/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="不合格项性质">不合格项性质<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fUnqualifiednature" nodeKey="bhgxxz" verify="required" reqtext="不合格项性质是必填项" />
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="依据标准">依据标准<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <select id="fAccordingstandar" name="fAccordingstandar" class="layui-input filter-value" lay-search="" lay-verify="required" lay-reqtext="依据标准是必填项" lay-filter="fAccordingstandar"></select>
                        </div>
                    </div>
                    <div class="qbdms-textarea">
                        <label class="layui-form-label qbdms-label" title="审核计划">审核计划<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <div class="doNotDelThisDiv layui-input-inline">
                                <div class="uploadFileCont">
                                    <button type="button"
                                            class="layui-btn fileUpload qbdms-fileUp iconfont iconupload"
                                            id="auditplanfileList"> 上传附件</button><i class="qbdms-fileUpText">支持单个附件上传，附件格式：doc  docx    pdf，文件大小限制不超过100M</i>
                                    <input type="text" id="auditplan" class="uploadInput"
                                           name="auditplan" fieldname="auditplan" style="display: none" lay-verify="required" lay-reqtext="审核计划是必填项">
                                    <div class="uploadFileList" fileUploadName="auditplan"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="qbdms-textarea">
                        <label class="layui-form-label qbdms-label" title="审核报告">审核报告</label>
                        <div class="layui-input-block qbdms-input">
                            <div class="doNotDelThisDiv layui-input-inline">
                                <div class="uploadFileCont">
                                    <button type="button"
                                            class="layui-btn fileUpload qbdms-fileUp iconfont iconupload"
                                            id="auditreportfileList"> 上传附件</button><i class="qbdms-fileUpText">支持单个附件上传，附件格式：doc  docx    pdf，文件大小限制不超过100M</i>
                                    <input type="text" id="accessory" class="uploadInput"
                                           name="auditreport" fieldname="auditreport" style="display: none">
                                    <div class="uploadFileList" fileUploadName="auditreport"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
             </#if>
            <#if qnzl=true>
            <div class="qbdms-formBody">
                <@fillDept.dept id="tbxx"/>
                <div class="layui-row">
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核项目名称">审核项目名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input " lay-verify="required" name="audititemsname" lay-reqtext="审核项目名称是必填项" maxlength="50" disabled="disabled">
                        </div>
                    </div>

                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核单位名称">审核单位名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="请输入" autocomplete="off" class="layui-input " lay-verify="required" name="fNameofauditinguni" lay-reqtext="审核单位名称是必填项" maxlength="50" disabled="disabled">
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="密级">密级<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@secSelect.sec_select data_src=1  activity=false  name="secret" />
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="受审单位名称">受审单位名称<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input type="text" placeholder="自动计算" autocomplete="off" class="layui-input textInput isReadonlyInput" lay-verify="required" lay-reqtext="受审单位名称是必填项" name="fTrialunitname" maxlength="50" disabled="disabled">
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="受审核部门">受审核部门<span style="color: red;">*</span></label>
                        <button type="button" typeid="6" class="layui-btn qbdms-twoBtn selectorBtn" style="display: none">选择</button>
                        <div class="layui-input-block qbdms-input qbdms-inputIsButton">
                            <input type="text" name="fTrialdeptname" readonly="readonly" placeholder="请选择"
                                   autocomplete="off" class="layui-input  selectorInput"
                                   maxlength="30" fieldname="fTrialdeptname"  lay-verify="required" lay-reqtext="受审核部门是必填项">
                            <input type="hidden" name="fTrialdeptnameid" placeholder="请输入受审核部门ID"
                                   autocomplete="off" class="layui-input  textInput getIds"
                                   fieldname="fTrialdeptnameid">
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核时间">审核时间<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <input disabled="disabled" type="text" placeholder="请选择" autocomplete="off" class="layui-input dateTimeFiled input-right time-init" name="fAudittime" format="yyyy-MM-dd" datetype="date" lay-verify="required" lay-reqtext="审核时间是必填项" disabled>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="审核类型">审核类型<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fAudittype" nodeKey="shlx" verify="required" reqtext="审核类型是必填项" activity=false/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="不合格项性质">不合格项性质<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <@dicSelect.dic name="fUnqualifiednature" nodeKey="bhgxxz" verify="required" reqtext="不合格项性质是必填项" activity=false/>
                        </div>
                    </div>
                    <div class="qbdms-oneForm  ">
                        <label class="layui-form-label qbdms-label" title="依据标准">依据标准<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <select disabled="disabled" id="fAccordingstandar" name="fAccordingstandar" class="layui-input filter-value" lay-search="" lay-verify="required" lay-reqtext="依据标准是必填项" lay-filter="fAccordingstandar" disabled></select>
                        </div>
                    </div>

                    <div class="qbdms-textarea">
                        <label class="layui-form-label qbdms-label" title="审核计划">审核计划<span style="color: red;">*</span></label>
                        <div class="layui-input-block qbdms-input">
                            <div class="doNotDelThisDiv layui-input-inline">
                                <div class="uploadFileCont">
<!--                                    <button type="button"-->
<!--                                            class="layui-btn fileUpload qbdms-fileUp iconfont iconupload"-->
<!--                                            id="auditplanfileList"> 上传附件</button><i class="qbdms-fileUpText">支持单个附件上传，附件格式：doc  docx    pdf，文件大小限制不超过100M</i>-->
                                    <input disabled="disabled" type="text" id="auditplan" class="uploadInput"
                                           name="auditplan" fieldname="auditplan" style="display: none" lay-verify="required" lay-reqtext="审核计划是必填项">
                                    <div class="uploadFileList" fileUploadName="auditplan"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="qbdms-textarea">
                        <label class="layui-form-label qbdms-label" title="审核报告">审核报告</label>
                        <div class="layui-input-block qbdms-input">
                            <div class="doNotDelThisDiv layui-input-inline">
                                <div class="uploadFileCont">
<!--                                    <button type="button"-->
<!--                                            class="layui-btn fileUpload qbdms-fileUp iconfont iconupload"-->
<!--                                            id="auditreportfileList"> 上传附件</button><i class="qbdms-fileUpText">支持单个附件上传，附件格式：doc  docx    pdf，文件大小限制不超过100M</i>-->
                                    <input type="text" id="accessory" class="uploadInput"
                                           name="auditreport" fieldname="auditreport" style="display: none">
                                    <div class="uploadFileList" fileUploadName="auditreport"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </#if>




            <p class="qbdms-SubTableTitle"><span>审核不符合项信息子表</span></p>
            <div class="qbdms-tableDiv">
                <#if qnzl=false>
                <a modetype="2" class="addFormTr1"
                   id="add">
                    <i class="layui-icon layui-icon-addition"></i>新增
                </a>
                </#if>
                <#if qnzl=true>
                <a modetype="2" class="addFormTr1" style="display: none"
                   id="add">
                    <i class="layui-icon layui-icon-addition"></i>新增
                </a>
                </#if>
                <table class="qbdms-temTable wQbdQualitymanageSuList subFormTable"
                       id="wQbdQualitymanageSuList" style="min-width: 1360px;">
                    <tbody>
                    <tr class="temSpace qbdms-temTable-thead">
                        <td class="temSpace" style="width: 30px;">
                            序号
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            标准条款<span style="color: red;">*</span>
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            标准内容</span>
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            子标准条款
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            子标准内容
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            不合格事实描述
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            责任单位
                        </td>
                        <#if qnzl=true>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            原因分析<span style="color: red;">*</span>
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            纠正措施<span style="color: red;">*</span>
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            举一反三<span style="color: red;">*</span>
                        </td>
                        <td class="temSpace subDialogShowState" style="width: 120px">
                            见证材料<span style="color: red;">*</span>
                        </td>
                       </#if>
                    <#if qnzl=false>
                        <td class="temSpace qbdms-subOptState">
                            管理
                        </td>
                    </#if>
                    </tr>
                    <tr class="temSpace subContTem">
                        <#if qnzl=false>
                        <td class="temSpace qbdms-temTable-seNumber">
                            <div class="temTag">0</div>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <select name="s:wQbdQualitymanageSuList:fstandardclause" class="fstandardclause" lay-filter="s:wQbdQualitymanageSuList:fstandardclause" requiredFlag="required" lay-reqtext="标准条款为必填项">
                                <option></option>
                            </select>
                            <input type="hidden" name="s:wQbdQualitymanageSuList:fstandardclauseId"/>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput fstandardcontent"
                                   name="s:wQbdQualitymanageSuList:fstandardcontent"
                                   maxlength="50"  readonly="readonly" >
                        </td>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <select name="s:wQbdQualitymanageSuList:fsubstandardclauses" class="fsubstandardclauses" lay-filter="s:wQbdQualitymanageSuList:fsubstandardclauses">
                                <option></option>
                            </select>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput fsubstandardcontent"
                                   name="s:wQbdQualitymanageSuList:fsubstandardcontent"
                                   maxlength="50"  readonly="readonly" >
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput"
                                   name="s:wQbdQualitymanageSuList:fdescriptionsubst"
                                   maxlength="50"  lay-reqtext="" style="width: 90%;display: inline">
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <select name="s:wQbdQualitymanageSuList:responsibleunit" class="responsibleunit" lay-filter="s:wQbdQualitymanageSuList:responsibleunit">
                                <option></option>
                            </select>
                            <input type="hidden" name="s:wQbdQualitymanageSuList:responsibleunitName">
                        </td>

                        <td class="temSpace qbdms-subOptState">
                            <a class="subDeleteTr RightBtn">删除</a>
                        </td>
                    </#if>


<!--                              禁止输入-->
                        <#if qnzl=true>
                        <td class="temSpace qbdms-temTable-seNumber">
                            <div class="temTag">0</div>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="hidden" name="s:wQbdQualitymanageSuList:id"/>
                            <select name="s:wQbdQualitymanageSuList:fstandardclause" class="fstandardclause" lay-filter="s:wQbdQualitymanageSuList:fstandardclause" requiredFlag="required" lay-reqtext="标准条款为必填项" disabled="disabled">
                                <option></option>
                            </select>
                            <input type="hidden" name="s:wQbdQualitymanageSuList:fstandardclauseId"/>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入" disabled="disabled"
                                   autocomplete="off"
                                   class="layui-input textInput fstandardcontent"
                                   name="s:wQbdQualitymanageSuList:fstandardcontent"
                                   maxlength="50"  readonly="readonly" >
                        </td>

                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <select name="s:wQbdQualitymanageSuList:fsubstandardclauses" class="fsubstandardclauses" lay-filter="s:wQbdQualitymanageSuList:fsubstandardclauses" disabled="disabled">
                                <option></option>
                            </select>
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput fsubstandardcontent"
                                   name="s:wQbdQualitymanageSuList:fsubstandardcontent" disabled="disabled"
                                   maxlength="50"  readonly="readonly" >
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput"
                                   name="s:wQbdQualitymanageSuList:fdescriptionsubst" disabled="disabled"
                                   maxlength="50"  lay-reqtext="" style="width: 90%;display: inline">
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <select name="s:wQbdQualitymanageSuList:responsibleunit" class="responsibleunit" lay-filter="s:wQbdQualitymanageSuList:responsibleunit" disabled="disabled">
                                <option></option>
                            </select>
                            <input type="hidden" name="s:wQbdQualitymanageSuList:responsibleunitName">
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput"
                                   name="s:wQbdQualitymanageSuList:fcauseanalysis" requiredFlag="required"
                                   maxlength="100"  lay-reqtext="原因分析是必填项" style="width: 90%;display: inline" >
                        </td>

                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput"
                                   name="s:wQbdQualitymanageSuList:fcorrectivemeasures"  requiredFlag="required"
                                   maxlength="100"  lay-reqtext="纠正措施是必填项" style="width: 90%;display: inline">
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <input type="text" placeholder="请输入"
                                   autocomplete="off"
                                   class="layui-input textInput"
                                   name="s:wQbdQualitymanageSuList:fciteoneantithree"  requiredFlag="required"
                                   maxlength="100"  lay-reqtext="举一反三是必填项" style="width: 90%;display: inline">
                        </td>
                        <td class="temSpace qbdms-temTable-td">
                            <div class="uploadFileCont">
                                <input type="button" class="layui-btn iconfont iconupload fileUpload qbdms-fileUp" id="fSkillcerfileList" value="上传附件" requiredFlag="fileRequired">
                                <input type="text" class="uploadInput"
                                       name="s:wQbdTecFundsplans:witnessmaterial"
                                       fieldname="s:wQbdTecFundsplans:witnessmaterial"
                                       style="display:none">
                                <div class="uploadFileList"
                                     fileUploadName="s:wQbdTecFundsplans:witnessmaterial"></div>
                            </div>
                        </td>
                    </#if>
<!--                        <td class="temSpace qbdms-subOptState">-->
<!--                            <a class="subDeleteTr RightBtn">删除</a>-->
<!--                        </td>-->
                    </tr>
                    </tbody>
                </table>
            </div>


            <div class="layui-hide">
                <input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input " maxlength="50" fieldname="id">
                <input type="text" name="fTrialunitnameid" placeholder="请输入受审单位名称ID" autocomplete="off" class="layui-input " maxlength="50" fieldname="fTrialunitnameid">
<!--                <input type="text" name="fTrialdeptnameid" placeholder="请输入受审核部门名称ID" autocomplete="off" class="layui-input " maxlength="50" fieldname="fTrialdeptnameid">-->
            </div>
            <div class="layui-form-item btnformItem">
                <p>
                    <span id="hideAndShow" style="display: none;">
                        <a lay-submit lay-filter="wQbdQualitymanage" class="layui-btn btn-n privateSubmit qbdms-oneBtn" requrl="${ctx}/qbdms/wQbdQualitymanage/save" id="urlFormSave">保存</a>
                        <a lay-filter="wProblemresetMsg" id="run" class="layui-btn btn-n qbdms-oneBtn">启动</a>
                        <button type="reset" id="closeWindow" style="margin-left: 10px;" class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">取消</button>
                    </span>
                </p>
            </div>
        </form>
    </div>
</div>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>

<script>
    var vaildFlag ;
    var runFlag=false;
    var flowStatus="${flowStatus}";
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'setter', 'layer', 'commonDialog','propsHandle', 'upload', 'common', 'laydate', 'jquery', 'publicMethods', 'qbdmsForm'], function () {

        // -----常量声明----------
        var $ = layui.jquery,
            laydate = layui.laydate,
            commonDialog=layui.commonDialog,
            setter = layui.setter,  // 配置信息
            layer = layui.layer,
            common = layui.common,
            propsHandle = layui.propsHandle,
            upload = layui.upload,
            publicMethods = layui.publicMethods,

            formId = '${formDefId}' || '',
            defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                formAreaInfo: '.formPreview',
                formAreaInfo: 'html',
                temDate: '.temDate',
                uploadFileBtn: '.uploadFileBtn',
                uploadImgBtn: '.uploadImgBtn',
                richTextArea: '.richTextArea',
                selectInput: '.selectInput',
                radioOptionCont: '.radioOptionCont',
                dataLexiTree: '.dataLexiTree',
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle(),  // 实例化模板功能部分
            form = layui.qbdmsForm;
        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        $(".subContTem").hide()
        // 子表初始化事件
        temQuery.initSubEvent(defProps, serverPath, setter);

        var dateTimeFiledLen = $(".dateTimeFiled");
        for (var i = 0; i < dateTimeFiledLen.length; i++) {
            laydate.render({
                elem: dateTimeFiledLen[i] //指定元素
                , type: 'date'
                , trigger: 'click'
            });
        }

        vaildFlag = false;
        $("#urlFormSave").click(function () {
            //- 附件密级不能高于表单密级 开始 ------------------------------------------------------
            var selectMaxVal = 0;
            var formSecretVal = $("[name='secret']").val();
            $(".fileSecLevel select").each(function () {
                selectMaxVal = selectMaxVal >= $(this).val() ? selectMaxVal : $(this).val();
            });

            if (selectMaxVal > formSecretVal) {
                layer.msg('附件密级不能高于表单密级。', {icon: 5});
                vaildFlag = false;
                return false;
            }
            //- 附件密级不能高于表单密级 结束 ------------------------------------------------------
            vaildFlag=form.VerifyForm("wQbdQualitymanageDataForm");
        });

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdQualitymanage/view/list';
        });
        //下载附件
        window.downFile = function (obj) {
            var fileId = $(obj).parents("span").attr("fileId");
            window.location.href = serverPath.qbdmsPath + setter.extendLinkPath + "attachFile/download?fileId=" + fileId;
        }

        var secSelect = '<@secSelect.sec_select data_src=1 hasBlank=false/>'
        common.uploadfun(".fileUpload",{
            acceptMime:'application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            exts:'doc|docx|pdf',
            secSelect:secSelect,
            isSub:false,
            upLoadSize: 102400
        })
        var count = 1;
        $(document).on('click', '.addFormTr1', function () {
            count += 1;
            var modetype = $(this).attr('modetype'),
                copyObj = $(this).parent().children('.subFormTable'),
                copyHtm = copyObj.find('tr').eq(1);
            if (modetype === '2') {
                //在这里做一个转换，控制子表隐藏行的必填
                var copyHtmlStr = copyHtm.html();
                copyHtmlStr = copyHtmlStr.replace(/requiredflag/g, "lay-verify");
                // 表格
                copyObj.append('<tr class="temSpace">' + copyHtmlStr + '</tr>');
                // copyObj.append('<tr class="temSpace">' + copyHtm.html() + '</tr>');
                var trArr = copyObj.find('tr');
                trArr.eq(trArr.length - 1).find('td').eq(0).find('.temTag').html(trArr.length - 2);
                // trArr.eq(trArr.length - 1).find('td').eq(6).find('button').attr("id","fSkillcerfileList"+count);
                trArr.eq(trArr.length - 1).find('.fileUpload').attr("id", "fSkillcerfileList" + count);

                trArr.eq(trArr.length - 1).find('[isinit="1"]').each(function (i, item) {
                    $(item).attr('isinit', '2');
                });
                if (trArr.length > 3) {
                    trArr.eq(trArr.length - 1).find('[type=radio]').each(function (i, item) {
                        $(item).attr('name', (trArr.eq(1).find('[type=radio]').eq(i).attr('name')) + '_' + (trArr.length - 2))
                    });
                }
                temQuery.initTemEvent(defProps, serverPath, setter);
            } else if (modetype === '1') {
                // updateTr(copyObj, copyHtm);
            }

            common.uploadfun("#" + "fSkillcerfileList" + count,{
                acceptMime:'application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document',
                exts:'doc|docx|pdf',
                secSelect:secSelect,
                isSub:true,
                upLoadSize: 102400
            })
            form.render();
            lay('.datetime').each(function () {
                laydate.render({
                    elem: this
                    , type: 'year'
                    , trigger: 'click'
                });
            });
            $(".datetime").removeAttr("lay-key");
            publicMethods.bottomFixd()
        });
        if(flowStatus == null || flowStatus == 0|| flowStatus==99){
            $("#hideAndShow").show();
        }else{
            $("#back").hide();
        }
        if(flowStatus==99){
            $("#run").hide();
        }

        var id = "${id}";
        if (id == null || id === '') {
            // 新增时要给受审单位名称设置默认值
            var unit = ${unit};
            $("input[name='fTrialunitname']").val(unit.orgName);
            $("input[name='fTrialunitnameid']").val(unit.code);
        }

        // var depts = ${depts}; //受审核部门下拉选项
        // var initDept = function (optionObj, item) {
        //     optionObj.text = item.itemName;
        //     optionObj.value = item.itemName;
        //     optionObj.setAttribute("code", item.itemValue);
        // };
        // common.initDicData("fTrialdeptname", depts, "", initDept);

        // 受审核部门选中事件
        // form.on('select(fTrialdeptname)', function (data) {
        //     // 获取所选部门的id
        //     var deptId = data.elem[data.elem.selectedIndex].getAttribute("code");
        //     // 给隐藏的受审部门id元素赋值
        //     $("input[name='fTrialdeptnameid']").val(deptId);
        // });

        //- 依据标准初始化 绑事件 开始 -------------------------------------------------------------
        var accordingStandards = ${accordingStandards};
        var accordingstandarHtml = "<option></option>";
        $.each(accordingStandards, function (index, obj) {
            accordingstandarHtml += "<option value='" + obj.accordingStandard + "'>" + obj.accordingStandard + "</option>";
        });
        $("#fAccordingstandar").html(accordingstandarHtml);

        // 依据标准选中事件
        form.on('select(fAccordingstandar)', function (data) {

            // 清空标准条款和子标准条款
            $("select[name='s:wQbdQualitymanageSuList:fstandardclause']").val("");
            $("input[name='s:wQbdQualitymanageSuList:fstandardcontent']").val("");
            // $("select[name='s:wQbdQualitymanageSuList:fSubstandardclauses']").html("");
            $(".fsubstandardclauses").html("");
            $("input[name='s:wQbdQualitymanageSuList:fsubstandardcontent']").val("");
            // 所选依据标准编码
            var accordingStandard = data.value;
            // 查询对应的标准条款
            setStandardClauseList(accordingStandard);
        });
        // 标准条款选中事件
        form.on('select(s:wQbdQualitymanageSuList:fstandardclause)', function (data) {
            var index=data.othis.parent().parent().find("td:eq(0)").text()
            // 当标准条款发生改变时,首先清空标准条款和子标准条款
            // $("select[name='s:wQbdQualitymanageSuList:fSubstandardclauses']").html("");
            // console.log($(".fsubstandardclauses"))
            // $("select[name='s:wQbdQualitymanageSuList:fsubstandardclauses']:eq("+index+")").html("");

            $(".fsubstandardclauses:eq("+index+")").html("");
            $("input[name='s:wQbdQualitymanageSuList:fsubstandardcontent']:eq("+index+")").val("");
            $("input[name='s:wQbdQualitymanageSuList:fstandardclauseId']:eq("+index+")").val("");

            // 所选标准条款id
            var standardclauseId = data.elem[data.elem.selectedIndex].getAttribute("data-id");
            // 所选标准条款内容
            var content = data.elem[data.elem.selectedIndex].getAttribute("data-content");
            // 给标准内容赋值
            $("input[name='s:wQbdQualitymanageSuList:fstandardcontent']:eq("+index+")").val(content);
            $("input[name='s:wQbdQualitymanageSuList:fstandardclauseId']:eq("+index+")").val(standardclauseId);
            // 查询对应的子标准条款
            setSubStandardClauseList(standardclauseId,index);
        });
        // 子标准条款选中事件
        form.on('select(s:wQbdQualitymanageSuList:fsubstandardclauses)', function (data) {
            // 所选子标准条款内容
            var index=data.othis.parent().parent().find("td:eq(0)").text()
            var content = data.elem[data.elem.selectedIndex].getAttribute("data-content");
            $("input[name='s:wQbdQualitymanageSuList:fsubstandardcontent']:eq("+index+")").val(content);

        });
        //- 依据标准初始化 绑事件 结束 -------------------------------------------------------------

        var index = parent.layer.getFrameIndex(window.name);
        var qnzl="${qnzl}";
        common.updateForm({
            name: 'wQbdQualitymanageDataForm',
            idValue: "${id}",
            primary: "id",
            beforeSubmitFun:function (data) {
                //- 附件密级不能高于表单密级 开始 ------------------------------------------------------
                var selectMaxVal = 0;
                var formSecretVal = $("[name='secret']").val();
                $(".fileSecLevel select").each(function () {
                    selectMaxVal = selectMaxVal >= $(this).val() ? selectMaxVal : $(this).val();
                });

                if (selectMaxVal > formSecretVal) {
                    layer.msg('附件密级不能高于表单密级。', {icon: 5});
                    return false;
                }
                //- 附件密级不能高于表单密级 结束 ------------------------------------------------------
                $(".uploadFileList").each(function (i,v) {
                    common.constructFileStr(v)
                });
                var files=[];
                //整理上传附件的隐藏域，将提交的字符串转为json对象
                $(".uploadInput").each(function(){
                    console.log($(this).attr("name"))
                    var uploadName = $(this).attr("name");
                    if (!$(this).val()) {
                        return;
                    }
                    data.field[uploadName] = eval($(this).val());
                    files=files.concat(eval($(this).val()));
                });
                common.setFileLevel(files);

                //子表数据
                var sub = [];
                $('table.subFormTable').each(function () {
                    var table = {
                        tableName: $(this).attr('class').split(" ")[1],
                        fields: []
                    };
                    $(this).find('tr.temSpace').each(function (i, item) {    /*修复需要提交隐藏的行数据的bug*/
                        if (i > 1) {
                            var row = {};
                            var objRow = $(this);
                            $("input:text[name^='s:'],input[type='hidden'][name^='s:'],textarea[name^='s:'],select[name^='s:'],ul[name^='m:']", objRow).each(function () {
                                var name = $(this).attr('name').replace(/.*:/, '');
                                row[name] = $(this).val();
                            });
                            row["sort"] = i - 1;
                            table.fields.push(row);
                        }
                    });
                    data.field[table.tableName] = table.fields;
                });

            },
            getCallback: function (data) {
                $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</span>");
                $("input[name='fTrialdeptname']").attr("ids", data.data.fTrialdeptname);
                $("input[name='fTrialdeptnameid']").attr("ids", data.data.fTrialdeptnameid);
                //-修改页面 初始化附件组件 开始 ------------------------------------------
                $('.uploadFileList').each(function () {
                    var fileUploadName = $(this).attr("fileUploadName");
                    var jsonFile = data.data[fileUploadName];
                    var files = eval(jsonFile);
                    if (files) {
                        for (var i = 0; i < files.length; i++) {
                            var fileLevel = files[i].fileLevel;
                            var fileLevelText = files[i].fileLevelText;
                            var fileSec = '<div class="fileSecLevel fileSecXg layui-input-inline">' + '<@secSelect.sec_select data_src=1 hasBlank=false/>' + "</div>";
                            var newStr = '<span class="file-id" style="margin-right: 20px;" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">' + fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)"><i class="iconfont data-iconcommon_fujian" style="margin-right: 5px"></i>' + files[i].fileName + '</span>  <i class="iconfont data-iconcommon_close deleteFile" ></i> </span>';
                            if (qnzl){
                                var newStr = '<span class="file-id" style="margin-right: 20px;" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">' + fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)"><i class="iconfont data-iconcommon_fujian" style="margin-right: 5px"></i>' + files[i].fileName + '</span> </span>';
                            }
                            $(this).html(newStr);
                            $(this).find("select:last").val(fileLevel);
                            if (qnzl){
                                $(this).find("select:last").attr("disabled", "disabled");
                            }
                        }
                    }
                });

                // 根据依据标准设置标准条款下拉选项
                // var fAccordingstandard = data.data.fAccordingstandar;
                // setStandardClauseList(fAccordingstandard);



                // 根据标准条款设置子标准条款下拉选项
                // var fStandardclause = data.data.fStandardclause;
                // setSubStandardClauseListByAccordingStandardAndStandardclause(fAccordingstandard, fStandardclause);
                //-修改页面 初始化子表 开始 ------------------------------------------
                var fAccordingstandar=data.data.fAccordingstandar;
                setStandardClauseList(fAccordingstandar);
                $('table.subFormTable').each(function () {
                    // console.log($(this).attr('class').split(" ")[1]);
                    var table = {
                        tableName: $(this).attr('class').split(" ")[1],
                        fields: []
                    };
                    table.fields = data.data[table.tableName];
                    if(table.fields.length > 0){
                        for (var i = 0, len = table.fields.length; i < len; i++) {
                            var dataRow = table.fields[i];
                            var temp = $("." + table.tableName).prev().click();
                            //这里有子表表头占一行，子表隐藏行占一行，所以取需要赋值的行时，需要temp=i+2
                            var domRow = $(this).find("tr.temSpace:eq(" + (i * 1 + 2) + ")");
                            $.each(dataRow, function (j, val) {
                                var domItem = domRow.find("[name$='" + j + "']");
                                if (domItem) {
                                    domItem.val(val);
                                    if(j=="fstandardclauseId"){
                                        setSubStandardClauseList(val,i+1);
                                    }

                                }
                            });
                        }
                    }
                });
                form.render();

                //-修改页面 初始化子表附件组件 开始 ------------------------------------------.
                $('.subFormTable').each(function (index, element) {
                    var id = $(this).attr('id');
                    $(element).find(".uploadFileList").each(function (index, element) {
                        if (index == '0') {
                            return true;
                        }
                        var fileUploadName = $(this).attr("fileUploadName");
                        var text = fileUploadName.split(":");
                        var jsonFile = "data.data." + id + "[" + (index * 1 - 1) + "]" + "." + text[2];
                        var files = eval(eval(jsonFile));
                        if (files) {
                            for (var i = 0; i < files.length; i++) {
                                var fileLevel = files[i].fileLevel;
                                var fileLevelText = files[i].fileLevelText;
                                var fileSec = '<div class="fileSecLevel fileSecXg layui-input-inline" style="margin: 8px 0 0;">' + '<@secSelect.sec_select data_src=1 hasBlank=false/>' + "</div>";
                                var newStr = '<span class="file-id" fileId=' + files[i].fileId + ' fileLevelText="' + fileLevelText + '">'+ fileSec + '<span class="file-name" title="点击下载文件" onclick="downFile(this)"><i class="iconfont data-iconcommon_fujian" style="margin-right: 5px"></i>' + files[i].fileName + '</span>' + '<i class="iconfont data-iconcommon_close deleteFile" ></i></span>';
                                $(this).html(newStr);
                                $(this).siblings("input[type=button]").hide();
                                $(this).find("select:last").val(fileLevel);
                                // $(this).find("select:last").attr("disabled", "disabled");
                            }
                        }
                    });
                });
                //-修改页面 初始化子表附件组件 结束 ------------------------------------------
            },
            updateCallback: function (data) {
                if((flowStatus==0||flowStatus==""||null==flowStatus)&&runFlag==true){
                    run(data.data.id);
                }
                if (publicMethods._filterRecord(data)) {
                    if ($(".privateSubmit")) {
                        $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
                    }
                    if((flowStatus=="0" || flowStatus==null||flowStatus==""||flowStatus=="99")&&runFlag==false) {
                       layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdQualitymanage/view/list';
                        });
                    }
                } else {
                    if((flowStatus=="0" || flowStatus==null||flowStatus==""||flowStatus=="99")&&runFlag==false) {
                        layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdQualitymanage/view/list';
                        });
                    }
                }
                runFlag=false;
                return false;
            }

        });

        // 设置标准条款下拉选项回显用
        function setStandardClauseListHX(accordingStandard,row,val) {
            $.ajax({
                url: '${ctx}/qbdms/wQbdStandardClause/getByAccordingStandard?accordingStandard=' + encodeURI(encodeURI(accordingStandard)),
                type: "get",
                dataType: 'json',
                contentType: 'application/json',
                data: {},
                async: false,
                success: function (data) {
                    $("select[name='s:wQbdQualitymanageSuList:fstandardclause']:eq("+row+")").html("");
                    var standardClauseList = data.data;
                    var standardClauseListHtml = "<option></option>";
                    $.each(standardClauseList, function (index, obj) {
                        if(val==obj.standardClause){
                            standardClauseListHtml += "<option selected data-id='" + obj.id + "' data-content='" + obj.standardClauseContent + "' value='" + obj.standardClause + "'>" + obj.standardClause + "</option>";
                        }
                        standardClauseListHtml += "<option data-id='" + obj.id + "' data-content='" + obj.standardClauseContent + "' value='" + obj.standardClause + "'>" + obj.standardClause + "</option>";
                    });
                    $("select[name='s:wQbdQualitymanageSuList:fstandardclause']:eq("+row+")").html(standardClauseListHtml);
                    // $(".fstandardclause:eq("+row+")").html(standardClauseListHtml);


                }
            })
            form.render("select");
        }

        // 设置标准条款下拉选项
        function setStandardClauseList(accordingStandard) {
            $.ajax({
                url: '${ctx}/qbdms/wQbdStandardClause/getByAccordingStandard?accordingStandard=' + encodeURI(encodeURI(accordingStandard)),
                type: "get",
                dataType: 'json',
                contentType: 'application/json',
                data: {},
                async: false,
                success: function (data) {
                    $("select[name='s:wQbdQualitymanageSuList:fstandardclause']").html("");
                    var standardClauseList = data.data;
                    var standardClauseListHtml = "<option></option>";
                    $.each(standardClauseList, function (index, obj) {
                        standardClauseListHtml += "<option data-id='" + obj.id + "' data-content='" + obj.standardClauseContent + "' value='" + obj.standardClause + "'>" + obj.standardClause + "</option>";
                    });
                    $("select[name='s:wQbdQualitymanageSuList:fstandardclause']").html(standardClauseListHtml);
                    // $(".fstandardclause:eq("+row+")").html(standardClauseListHtml);


                }
            })
            form.render("select");
        }

        // 设置子标准条款下拉选项
        function setSubStandardClauseList(standardClauseId,row) {
            $.ajax({
                url: '${ctx}/qbdms/wQbdSubStandardClause/getByStandardClauseId',
                type: "get",
                dataType: 'json',
                contentType: 'application/json',
                data: {
                    standardClauseId: standardClauseId
                },
                async: false,
                success: function (data) {
                    $("select[name='s:wQbdQualitymanageSuList:fSubstandardclauses']:eq("+row+")").html("");
                    var subStandardClauseList = data.data;
                    var standardClauseListHtml = "<option></option>";
                    $.each(subStandardClauseList, function (index, obj) {
                        standardClauseListHtml += "<option data-content='" + obj.subStandardClauseContent + "' value='" + obj.subStandardClause + "'>" + obj.subStandardClause + "</option>";
                    });
                    // $("select[name='s:wQbdQualitymanageSuList:fSubstandardclauses']").html(standardClauseListHtml);
                    // console.log(standardClauseListHtml)
                    $(".fsubstandardclauses:eq("+row+")").html(standardClauseListHtml);


                }
            })
            form.render("select");
        }

        function setSubStandardClauseListByAccordingStandardAndStandardclause(accordingStandard, standardclause) {
            $.ajax({
                url: serverPath.qbdmsPath + '/qbdms/wQbdSubStandardClause/getByAccordingStandardAndStandardClause?accordingStandard=' + accordingStandard + '&standardClause=' + encodeURI(encodeURI(standardclause)),
                type: "get",
                dataType: 'json',
                contentType: 'application/json',
                data: {},
                async: false,
                success: function (data) {
                    $("select[name='fSubstandardclauses']").html("");
                    var subStandardClauseList = data.data;
                    var standardClauseListHtml = "<option></option>";
                    $.each(subStandardClauseList, function (index, obj) {
                        standardClauseListHtml += "<option data-content='" + obj.subStandardClauseContent + "' value='" + obj.subStandardClause + "'>" + obj.subStandardClause + "</option>";
                    });
                    $(".fSubstandardclauses").html(standardClauseListHtml);
                }
            })
            form.render("select");
        }



        publicMethods.bottomFixd()
        form.on('select', function (data) {
            publicMethods.bottomFixd()
        });
        form.render();

        var researchRoomList = eval('${researchRoomList}'); //问题责任单位（研究室）
        var researchRoom = function(optionObj, item){
            optionObj.text = item.orgName;
            optionObj.value = item.code;
        };
        common.initDicData("s:wQbdQualitymanageSuList:responsibleunit", researchRoomList, "", researchRoom);
        form.on('select(s:wQbdQualitymanageSuList:responsibleunit)', function (data) {
            // $("input[name='s:wQbdQualitymanageSuList:responsibleunitName']").val(data.elem[data.elem.selectedIndex].text);
        });

        $("#run").click(function () {
            var flag=form.VerifyForm("wQbdQualitymanageDataForm");
            if(flag==false){
                return false;
            }
            runFlag=true;
            $("#urlFormSave").click();
        })
        function run(id) {
            var nowData = {"id": id};
            $.ajax({
                url:"${ctx}/qbdms/wQbdQualitymanage/run",
                type: "post",
                dataType: 'json',
                contentType : 'application/json',
                data: JSON.stringify(nowData),
                success : function (data) {
                    if (common.filterRecord(data)) {
                        layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdQualitymanage/view/list';
                        });
                    } else {
                        layer.alert(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdQualitymanage/view/list';
                        });
                    }
                    return false;
                },
                error : function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.alert(publicMethods.confirmStyle("内容已保存，启动失败"),{title: false,skin: 'confirm-class'}, function (index) {
                        layer.close(index);
                        window.location.href = serverPath.qbdmsPath + '/qbdms/wQbdQualitymanage/view/list';
                    });
                }
            })
        }
    });
</script>
</body>
</html>